# Contributor: kpcyrd <git@rxv.cc>
# Maintainer: kpcyrd <git@rxv.cc>
pkgname=acmetool
pkgver=0.2.2
pkgrel=5
pkgdesc="An easy-to-use command line tool for automatically acquiring certificates from ACME servers (such as Let's Encrypt)"
url="https://github.com/hlandau/acmetool"
arch="all"
license="MIT"
makedepends="go libcap-dev"
subpackages="$pkgname-doc"
# no test suite available
options="!check net"
source="$pkgname-$pkgver.tar.gz::https://github.com/hlandau/acmetool/archive/v$pkgver.tar.gz
	go.mod
	go.sum
	"

export GOPATH="$srcdir/go"
export GOCACHE="$srcdir/go-build"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

prepare() {
	default_prepare

	cp "$srcdir"/go.mod "$srcdir"/go.sum "$builddir"/
}

build() {
	go build -v \
		-ldflags "-X github.com/hlandau/acmetool/hooks.DefaultPath=/etc/acme/hooks" \
		./cmd/acmetool/...
}

package() {
	install -Dm 755 acmetool "$pkgdir/usr/bin/acmetool"

	install -Dm644 README.md "$pkgdir/usr/share/doc/acmetool/README"
	cp -a _doc/* "$pkgdir/usr/share/doc/$pkgname/"
}

sha512sums="
c24bebbf52664cfda0442db86f8437244322a709413fdd03a79294feac99045f0e06b4342a6186ae4aa400fb627e740f00eadf7522919d3faff4270badb38451  acmetool-0.2.2.tar.gz
5c3e8400b46fbfe00553698c200075367bd6d6e19d3aaddf8029c9a3e43ae0b9a19496175358d8439cd6edf0d1652d68ed1ae1980318bad8f04112f7ef009841  go.mod
e52269c2d78c8ca6e769ae918b369591e8965db0283e7c8c2f18531e4af36fd71589596d91dbf0f75fd5aeca36d95c522f28a4c8ae006a300a8ea9fc2e3eb305  go.sum
"
